<template>
  <el-form ref="form"
           :inline="true"
           :model="form">
    <el-form-item prop="search">
      <el-input v-model="form.search"
                prefix-icon="el-icon-search"
                style="width:300px;"
                placeholder="请输入部门名称" />
    </el-form-item>

    <el-form-item>
      <el-button type="primary"
                 icon="el-icon-search"
                 @click="handleFormSubmit">
        查询
      </el-button>
    </el-form-item>
    <el-form-item>
      <el-button icon="el-icon-delete"
                 @click="handleFormReset">
        重置
      </el-button>
    </el-form-item>
  </el-form>
</template>

<script>
export default {
  data() {
    return {
      form: {
        search: null
      }
    }
  },
  methods: {
    handleFormSubmit() {
      this.$emit('change', this.form)
      this.$emit('submit')
    },
    handleFormReset() {
      this.$refs.form.resetFields()
      this.handleFormSubmit()
    }
  }
}
</script>
